package com.matace.keychain.presentation.view;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;

import com.matace.keychain.R;
import com.matace.keychain.data.SplashRepositoryImpl;
import com.matace.keychain.domain.SplashUseCase;

// 启动页 Activity
@SuppressLint("CustomSplashScreen")
public class SplashActivity extends AppCompatActivity {
    private SplashUseCase splashUseCase;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 设置启动页布局
        setContentView(R.layout.activity_splash);
        // 实例化启动页用例，设置延迟 3000 毫秒
        splashUseCase = new SplashRepositoryImpl(3000);
        // 启动延迟，延迟结束后跳转到登录页
        splashUseCase.startSplash(() -> {
            Intent intent = new Intent(SplashActivity.this, LoginActivity.class);
            startActivity(intent);
            finish(); // 关闭当前启动页 Activity
        });
    }
}
